home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacWorld 1999 April
/
Macworld (1999-04).dmg
/
Shareware World
/
Comms & Internet
/
Snak 2.0.1
/
Scripts
/
pp-bots.irc
< prev
next >
Wrap
Text File
|
1996-03-22
|
25KB
|
786 lines
# ########################################################################## #
# PurePak - The sequel to TextBox #
# A -+ TEXT +- production #
# ########################################################################## #
# Author: Crypt Keeper [ckeeper@axiom.access.one.net] (CKeeper on IRC)
# Version 2.07
#
# This script requires at least ircII2.2.9 (Unix) or a fully ircII compatible
# client. It has only been tested under Unix with ircII2.2.9 and ircII2.8.
#
# This file may not be edited in a DOS text editor _OR_ converted with
# utilities such as unix2dos/dos2unix. It contains characters that will
# be lost or corrupted in either case.
#
# PurePak version 2.07 IRC script
# Copyright (C) 1995
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 1, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# ########################################################################## #
# DCC RAW bots script - no floods or war commands in here, only basic bot
# control and guarding/spy functions
EVAL ^if (!(PPVERS)) {/echo *** pp-bots.irc cannot be loaded as a stand-alone script. It must be loaded after purepak.irc.;//exit}
@ PP.BOTS = 1
# ----------------------------------------------------------------------------
# Variables to add to /pp
# ----------------------------------------------------------------------------
# Default bot options that bots are created with
EVAL ^if (!(PP.SET.BOTS_DFL_OPT)) {@ PP.SET.BOTS_DFL_OPT = [X]}
# Alias to set bots script options
@ PP.SETCHECKS.BOTS = [/pp.set.bots]
# DEFBotopt = Default bot options
alias pp.set.bots {
if (match(DEFB* $0))
{
if ([$1]) {@ PP.SET.BOTS_DFL_OPT = bots.setbotopt($PP.SET.BOTS_DFL_OPT $1-)}
echo *** Default bot options are now: $bots.querybotopt($PP.SET.BOTS_DFL_OPT)
@ VU = 1
}
}
# ----------------------------------------------------------------------------
# Aliases for controlling bot options
# ----------------------------------------------------------------------------
alias bots.querybotopt {
if (index(F $0) >= 0) {@ BOTMODS = [FOLLOW ]}
if (index(L $0) >= 0) {@ BOTMODS = BOTMODS##[FOLLOWLEAVE ]}
if (index(M $0) >= 0) {@ BOTMODS = BOTMODS##[SPYMSG ]}
if (index(P $0) >= 0) {@ BOTMODS = BOTMODS##[SPYPUB ]}
if (index(C $0) >= 0) {@ BOTMODS = BOTMODS##[SPYCTCP ]}
if (index(J $0) >= 0) {@ BOTMODS = BOTMODS##[SPYJUNK ]}
if (index(O $0) >= 0) {@ BOTMODS = BOTMODS##[OPSGUARD ]}
if (index(K $0) >= 0) {@ BOTMODS = BOTMODS##[KICKGUARD ]}
if (index(B $0) >= 0) {@ BOTMODS = BOTMODS##[BANGUARD]}
@ FUNCTION_RETURN = BOTMODS
^assign -BOTMODS
}
# bots.setbotopt <current opt string> <settings/-settings>
# Possible settings:
# FOLLOW,FOLLOWLEAVE,SPYMSG,SPYPUB,SPYCTCP,SPYJUNK,OPSGUARD,KICKGUARD,BANGUARD
alias bots.setbotopt {
@ NEWOPT = [$0]
if (match(-FOLLOW $1-)) {@ NEWOPT = strip(F $NEWOPT)}
if (match(FOLLOW $1-)) {^if (index(F $NEWOPT) < 0) {@ NEWOPT = NEWOPT##[F]}}
if (match(-FOLLOWL* $1-)) {@ NEWOPT = strip(L $NEWOPT)}
if (match(FOLLOWL* $1-)) {^if (index(L $NEWOPT) < 0) {@ NEWOPT = NEWOPT##[L]}}
if (match(-SPYM* $1-)) {@ NEWOPT = strip(M $NEWOPT)}
if (match(SPYM* $1-)) {^if (index(M $NEWOPT) < 0) {@ NEWOPT = NEWOPT##[M]}}
if (match(-SPYP* $1-)) {@ NEWOPT = strip(P $NEWOPT)}
if (match(SPYP* $1-)) {^if (index(P $NEWOPT) < 0) {@ NEWOPT = NEWOPT##[P]}}
if (match(-SPYC* $1-)) {@ NEWOPT = strip(C $NEWOPT)}
if (match(SPYC* $1-)) {^if (index(C $NEWOPT) < 0) {@ NEWOPT = NEWOPT##[C]}}
if (match(-SPYJ* $1-)) {@ NEWOPT = strip(J $NEWOPT)}
if (match(SPYJ* $1-)) {^if (index(J $NEWOPT) < 0) {@ NEWOPT = NEWOPT##[J]}}
if (match(-OPS* $1-)) {@ NEWOPT = strip(O $NEWOPT)}
if (match(OPS* $1-)) {^if (index(O $NEWOPT) < 0) {@ NEWOPT = NEWOPT##[O]}}
if (match(-KICK* $1-)) {@ NEWOPT = strip(K $NEWOPT)}
if (match(KICK* $1-)) {^if (index(K $NEWOPT) < 0) {@ NEWOPT = NEWOPT##[K]}}
if (match(-BAN* $1-)) {@ NEWOPT = strip(B $NEWOPT)}
if (match(BAN* $1-)) {^if (index(B $NEWOPT) < 0) {@ NEWOPT = NEWOPT##[B]}}
@ FUNCTION_RETURN = NEWOPT
^assign -NEWOPT
}
# ----------------------------------------------------------------------------
# ONs and guardbot code
# ----------------------------------------------------------------------------
on #^join 21 * {
if ([$0] == N) {
^foreach BOTS AA {
if (index(F $word(5 $BOTS[$AA])) >= 0) {//^dcc raw $word(0 $BOTS[$AA]) $word(1 $BOTS[$AA]) JOIN $1}
if (index(O $word(5 $BOTS[$AA])) >= 0) {//^dcc raw $word(0 $BOTS[$AA]) $word(1 $BOTS[$AA]) MODE $1 +o $N}
}
}
if ((match($0 $PP.OPGUARDS))&&(gotops($1))) {//mode $1 +o $0}
}
on #^leave 21 * {^if ([$0] == N) {^foreach BOTS AA {^if (index(L $word(5 $BOTS[$AA])) >= 0) {//^dcc raw $word(0 $BOTS[$AA]) $word(1 $BOTS[$AA]) PART $1}}}}
on #^mode 21 * {
if ([$0] != N)
{
if (match(*+b* $2))
{
@ CSTR = N##[!$PP.UHOST]
if (rmatch($CSTR $3-))
{
if (match($3 $CSTR)) {@ UNBANZ = [$3 ]}
if (match($4 $CSTR)) {@ UNBANZ = UNBANZ##[$4 ]}
if (match($5 $CSTR)) {@ UNBANZ = UNBANZ##[$5 ]}
if (match($6 $CSTR)) {@ UNBANZ = UNBANZ##[$6 ]}
foreach BOTS AA {
if (index(B $word(5 $BOTS[$AA])) >= 0)
{
//dcc raw $word(0 $BOTS[$AA]) $word(1 $BOTS[$AA]) MODE $1 -o-bbbb $0 $UNBANZ
@ BOTSTRIGD = 1
}
}
if (BOTSTRIGD) {/echo *** Guardbot BAN protection triggered by $0 on channel $1}
^assign -UNBANZ
^assign -BOTSTRIGD
}
^assign -CSTR
}
if (!gotops($1)) {^if ((match(*+o* $2))&&(match($N $3-))) {^timer 1 ^bots.opchk $0 $1}}
{
if (match(*-o* $2))
{
if (match($N $3-)) {^timer 1 ^bots.dopchk $0 $1}
if (match($3 $PP.OPGUARDS)) {//mode $1 +o $3}
if (match($4 $PP.OPGUARDS)) {//mode $1 +o $4}
if (match($5 $PP.OPGUARDS)) {//mode $1 +o $5}
if (match($6 $PP.OPGUARDS)) {//mode $1 +o $6}
}
}
}
}
alias bots.opchk {
if (gotops($1))
{
^on ^who * {^if ((match($1 $PP.OPGUARDS))&&(!match(*@* $2))) {//mode $0 +o $1}}
//^who $1
wait -CMD if (1) {
^on who -
^assign -OBZ
}
}
}
alias bots.dopchk {
if (!gotops($1))
{
foreach BOTS AA {
if (index(O $word(5 $BOTS[$AA])) >= 0)
{
//dcc raw $word(0 $BOTS[$AA]) $word(1 $BOTS[$AA]) MODE $1 -o+o $0 $N
@ BOTSTRIGD = 1
}
}
if (BOTSTRIGD) {/echo *** Guardbot DEOP protection triggered by $0 on channel $1}
^assign -BOTSTRIGD
}
}
alias bots.onkick {
if ([$3] == N)
{
foreach BOTS AA {^if (index(K $word(5 $BOTS[$AA])) >= 0) {//dcc raw $word(0 $BOTS[$AA]) $word(1 $BOTS[$AA]) KICK $2 $KNICK :That wasn't very smart!}}
}
}
alias bots.makevars {
^assign -PP.OPGUARDS
^assign -PP.BOTNICKS
foreach BOTS AA {
if (index(O $word(5 $BOTS[$AA])) >= 0) {@ PP.OPGUARDS = PP.OPGUARDS##[$word(3 $BOTS[$AA]) ]}
@ PP.BOTNICKS = PP.BOTNICKS##[$word(3 $BOTS[$AA]) ]
}
}
# Ops all of your bots on channel
alias opbots {
^on ^who * {^if (match($1 $PP.BOTNICKS)) {@ BTZ = BTZ##[$1 ]}}
//^who *
wait -CMD if (1) {
^on who -
if (BTZ)
{
op $BTZ
^assign -BTZ
} {/echo *** You don't have any bots on $C}
}
}
# /bot massdeop
# massdeops current channel 4 at a time using all bots on channel as helpers
alias bots.massdeop {
echo *** Massdeopping $C using all clonebots on channel
^on ^who * {
^if (match($1 $PP.BOTNICKS))
{
if (!match(*@* $2)) {@ BTZ = BTZ##[$1 ]}
@ GBOTZ = 1
}
}
echo *** Making sure all bots have ops...
//^who *
wait -CMD if (1) {
^on who -
if (GBOTZ)
{
op $BTZ
@ CT = 0
while (word($CT $BTZ))
{
@ BN = 0
foreach BOTS AA {^if (word(3 $BOTS[$AA]) == word($CT $BTZ)) {@ BN = AA}}
if (BN) {@ BTZ2 = BTZ2##[$BN ]}
@ CT = CT + 1
}
^timer 2 /echo *** Massdeopping in about 8 seconds...
^assign -BN
^assign -BTZ
^assign -CT
EVAL ^timer 10 ^bots.massdeop.doit $C $BTZ2
^assign -GBOTZ
^assign -BTZ2
} {/echo *** You have no bots on $C}
}
}
alias bots.massdeop.doit {
@ MDCHAN = [$0]
@ MDNUMS = [$1-]
^on ^who * {^if ((!match($1 $PP.BOTNICKS))&&([$1] != N)) {@ MDOPZ = MDOPZ##[$1 ]}}
echo *** Massdeopping using bots: $MDNUMS
//^who -chops *
wait -CMD if (1) {
^on who -
@ MDNUMS = [65535 ]##MDNUMS
@ BOTCTR = 0
@ NICKCTR = 0
while (word($NICKCTR $MDOPZ))
{
@ LISTS[$BOTCTR] = LISTS[$BOTCTR]##[$word($NICKCTR $MDOPZ) ]
@ NICKCTR = NICKCTR + 1
@ BOTCTR = BOTCTR + 1
if (BOTCTR >= [$#MDNUMS]) {@ BOTCTR = 0}
}
foreach LISTS AA {
bots.massdeop.dodeops $MDCHAN $word($AA $MDNUMS) $LISTS[$AA]
^assign -LISTS[$AA]
}
@ BOTCTR = 0
while (word($BOTCTR $MDNUMS))
{
bots.massdeop.dodeops $MDCHAN $word($BOTCTR $MDNUMS) $MDOPZ
@ BOTCTR = BOTCTR + 1
}
EVAL ^timer 2 ^bot * mode $MDCHAN +o $N
^assign -MDOPZ
^assign -MDNUMS
^assign -BOTCTR
^assign -NICKCTR
^assign -MDCHAN
}
}
alias bots.massdeop.dodeops {
if ([$1] == 65535)
{
//mode $0 -oooo $2 $3 $4 $5
if ([$6]) {^bots.massdeop.dodeops $0 $1 $6-}
}
{
//dcc raw $word(0 $BOTS[$1]) $word(1 $BOTS[$1]) MODE $0 -oooo $2 $3 $4 $5
if ([$6]) {^bots.massdeop.dodeops $0 $1 $6-}
}
}
# ----------------------------------------------------------------------------
# Handlers for clonebot spy functions
# ----------------------------------------------------------------------------
alias bots.dospyons {
foreach BOTS AA {
if (rmatch($word(5 $BOTS[$AA]) *M* *P* *C*))
{
EVAL ^on ^dcc_raw "$word(0 $BOTS[$AA]) $word(1 $BOTS[$AA]) D % PRIVMSG *" {^bots.gotmsg $BOTSOCKS[$0] $strip(
$3-)}
EVAL ^on ^dcc_raw "$word(0 $BOTS[$AA]) $word(1 $BOTS[$AA]) D % NOTICE *" {^bots.gotmsg $BOTSOCKS[$0] $strip(
$3-)}
}
{
EVAL ^on dcc_raw - "$word(0 $BOTS[$AA]) $word(1 $BOTS[$AA]) D % PRIVMSG *"
EVAL ^on dcc_raw - "$word(0 $BOTS[$AA]) $word(1 $BOTS[$AA]) D % NOTICE *"
}
if (index(J $word(5 $BOTS[$AA])) >= 0)
{
EVAL ^on ^dcc_raw "$word(0 $BOTS[$AA]) $word(1 $BOTS[$AA]) D % JOIN *" {^bots.gotjunk $BOTSOCKS[$0] $strip(
$3-)}
EVAL ^on ^dcc_raw "$word(0 $BOTS[$AA]) $word(1 $BOTS[$AA]) D % PART *" {^bots.gotjunk $BOTSOCKS[$0] $strip(
$3-)}
EVAL ^on ^dcc_raw "$word(0 $BOTS[$AA]) $word(1 $BOTS[$AA]) D % QUIT *" {^bots.gotjunk $BOTSOCKS[$0] $strip(
$3-)}
EVAL ^on ^dcc_raw "$word(0 $BOTS[$AA]) $word(1 $BOTS[$AA]) D % MODE *" {^bots.gotjunk $BOTSOCKS[$0] $strip(
$3-)}
EVAL ^on ^dcc_raw "$word(0 $BOTS[$AA]) $word(1 $BOTS[$AA]) D % NICK *" {^bots.gotjunk $BOTSOCKS[$0] $strip(
$3-)}
EVAL ^on ^dcc_raw "$word(0 $BOTS[$AA]) $word(1 $BOTS[$AA]) D % KICK *" {^bots.gotjunk $BOTSOCKS[$0] $strip(
$3-)}
}
{
EVAL ^on dcc_raw - "$word(0 $BOTS[$AA]) $word(1 $BOTS[$AA]) D % JOIN *"
EVAL ^on dcc_raw - "$word(0 $BOTS[$AA]) $word(1 $BOTS[$AA]) D % PART *"
EVAL ^on dcc_raw - "$word(0 $BOTS[$AA]) $word(1 $BOTS[$AA]) D % QUIT *"
EVAL ^on dcc_raw - "$word(0 $BOTS[$AA]) $word(1 $BOTS[$AA]) D % MODE *"
EVAL ^on dcc_raw - "$word(0 $BOTS[$AA]) $word(1 $BOTS[$AA]) D % NICK *"
EVAL ^on dcc_raw - "$word(0 $BOTS[$AA]) $word(1 $BOTS[$AA]) D % KICK *"
}
}
}
# bots.clearspyons <botno>
alias bots.clearons {
EVAL ^on dcc_raw - "$word(0 $BOTS[$0]) $word(1 $BOTS[$0]) D % PRIVMSG *"
EVAL ^on dcc_raw - "$word(0 $BOTS[$0]) $word(1 $BOTS[$0]) D % NOTICE *"
EVAL ^on dcc_raw - "$word(0 $BOTS[$0]) $word(1 $BOTS[$0]) D % JOIN *"
EVAL ^on dcc_raw - "$word(0 $BOTS[$0]) $word(1 $BOTS[$0]) D % PART *"
EVAL ^on dcc_raw - "$word(0 $BOTS[$0]) $word(1 $BOTS[$0]) D % QUIT *"
EVAL ^on dcc_raw - "$word(0 $BOTS[$0]) $word(1 $BOTS[$0]) D % MODE *"
EVAL ^on dcc_raw - "$word(0 $BOTS[$0]) $word(1 $BOTS[$0]) D % NICK *"
EVAL ^on dcc_raw - "$word(0 $BOTS[$0]) $word(1 $BOTS[$0]) D % KICK *"
EVAL ^on dcc_raw - "$word(0 $BOTS[$0]) $word(1 $BOTS[$0]) C*"
EVAL ^on dcc_raw - "$word(0 $BOTS[$0]) $word(1 $BOTS[$0]) D PING *"
}
alias bots.gotmsg {
if (([$2] == [PRIVMSG])&&(!match(*.* $nickonly($1))))
{
if (match(** $4-)) {^bots.gotctcp $*}
{
if (ischannel($3)) {^if (index(P $word(5 $BOTS[$0])) >= 0) {/echo [$0:$word(3 $BOTS[$0])] <$nickonly($strip(: $1)):$3> $strip(: $4) $5-}}
{^if (index(M $word(5 $BOTS[$0])) >= 0) {/echo [$0:$word(3 $BOTS[$0])] [$strip(: $1)] $strip(: $4) $5-}}
}
}
{
if (!match(*.* $nickonly($1)))
{
if (match(** $4-)) {^bots.gotctcp $*}
{
if (ischannel($3)) {^if (index(P $word(5 $BOTS[$0])) >= 0) {/echo [$0:$word(3 $BOTS[$0])] -$nickonly($strip(: $1)):$3\- $strip(: $4) $5-}}
{^if (index(M $word(5 $BOTS[$0])) >= 0) {/echo [$0:$word(3 $BOTS[$0])] -$strip(: $1)- $strip(: $4) $5-}}
}
}
}
}
alias bots.gotctcp {^if (index(C $word(5 $BOTS[$AA])) >= 0) {/echo [$0:$word(3 $BOTS[$0])] CTCP from $nickonly($strip(: $1)) to $3: $strip(: $4-)}}
alias bots.gotjunk {
if ([$2] == [JOIN])
{
echo [$0:$word(3 $BOTS[$0])] $nickonly($strip(: $1)) \($strip( $mid(${index(! $1)+1} $rindex($right(1 $1) $1) $1))\) has joined channel $strip(: $3)
}
if ([$2] == [PART])
{
echo [$0:$word(3 $BOTS[$0])] $nickonly($strip(: $1)) has left channel $strip(: $3)
}
if ([$2] == [QUIT])
{
echo [$0:$word(3 $BOTS[$0])] Signoff: $nickonly($strip(: $1)) \($strip(: $3-)\)
}
if ([$2] == [MODE])
{
echo [$0:$word(3 $BOTS[$0])] Mode change "$strip(: $4-)" on channel $strip(: $3) by $nickonly($strip(: $1))
}
if ([$2] == [NICK])
{
echo [$0:$word(3 $BOTS[$0])] $nickonly($strip(: $1)) is now known as $strip(: $3)
}
if ([$2] == [KICK])
{
if ([$4] == word(3 $BOTS[$0]))
{
echo [$0:$word(3 $BOTS[$0])] I have been kicked off channel $3 by $nickonly($strip(: $1)) \($strip(: $5-)\)
}
{
echo [$0:$word(3 $BOTS[$0])] $4 has been kicked off channel $3 by $nickonly($strip(: $1)) \($strip(: $5-)\)
}
}
}
# ----------------------------------------------------------------------------
# Internal bot creation/control aliases
# ----------------------------------------------------------------------------
# Bot array: BOTS[botno] :
# word 0 - socket
# word 1 - server
# word 2 - port on server
# word 3 - nick
# word 4 - username
# word 5 - options - see below
# word 6+ - IRCName
# Socket quick-id array: BOTSOCKS[socket] = botno
# Bot options:
# F - Follow you as you join channels
# L - Also follow you as you leave channels
# M - Report private msgs it gets to you
# P - Report public chatter to you
# C - Report CTCPs to you
# J - Report junk (joins, leaves, signoffs, nick changes, etc.) to you
# O - Ops guardbot mode - you keep bot opped, bot keeps you opped
# K - Kick defense guard mode - if bot has ops, retaliate if you are kicked
# B - Ban defense guard mode - bot takes action if you are banned
# bots.domake <botno> <server> <port> <nick> <username> <options> <IRCName>
alias bots.domake {
^set display off
@ NEWSOCK = connect($1 $2)
^set display on
if (NEWSOCK >= 0)
{
//dcc raw $NEWSOCK $1 NICK $3
//dcc raw $NEWSOCK $1 USER $4 . . :$6-
//dcc raw $NEWSOCK $1 MODE $3 +i
@ BOTS[$0] = [$NEWSOCK ]##[$1-]
@ BOTSOCKS[$NEWSOCK] = [$0]
EVAL ^on ^dcc_raw "$NEWSOCK $1 C*" {/EVAL ^timer 1 ^bots.connclosed $BOTSOCKS[$0]}
EVAL ^on ^dcc_raw "$NEWSOCK $1 D PING *" {//dcc raw $0 $1 PONG}
@ FUNCTION_RETURN = 1
} {@ FUNCTION_RETURN = 0}
^assign -NEWSOCK
}
alias bots.connclosed {
echo *** Bot #$0 disconnected by server $word(1 $BOTS[$0])
^bots.clearons $0
^assign -BOTSOCKS[$word(0 $BOTS[$0])]
^assign -BOTS[$0]
^bots.makevars
}
# bots.dokill <botno> <signoff msg>
alias bots.dokill {
if (BOTS[$0])
{
^bots.clearons $0
//dcc raw $word(0 $BOTS[$0]) $word(1 $BOTS[$0]) QUIT :$1-
EVAL ^timer 4 //^dcc close raw $word(0 $BOTS[$0])
^assign -BOTSOCKS[$word(0 $BOTS[$0])]
^assign -BOTS[$0]
^bots.makevars
@ FUNCTION_RETURN = 1
} {@ FUNCTION_RETURN = 0}
}
# bots.setopt <botno> <option index> <new value>
alias bots.setopt {
@ CTR = 0
while (word($CTR $BOTS[$0]))
{
if ([$1] == CTR) {@ NBOTS = NBOTS##[$2 ]} {@ NBOTS = NBOTS##[$word($CTR $BOTS[$0]) ]}
@ CTR = CTR + 1
}
@ BOTS[$0] = NBOTS
^assign -NBOTS
^assign -CTR
}
# bots.action <botno> <command> [<parameters>]
# Commands:
# JOIN [<channel>]
# LEAVE [<channel>]
# MSG <nick/channel> <msg>
# SAY [<#channel>] <msg>
# NOTICE <nick/channel> <msg>
# NICK <new nick>
# RANDNICK
# CTCP <nick/channel> <ctcp-cmd>
# MODE [<#channel>] <mode>
# QUOTE <line to send to server>
# INVITE <nick> [<channel>]
# SET <options/-options>
# ME [<channel>] <msg>
alias bots.action {
if ([$1] == [ME])
{
if (ischannel($2)) {//dcc raw $word(0 $BOTS[$0]) $word(1 $BOTS[$0]) PRIVMSG $2 :ACTION $3-}
{//dcc raw $word(0 $BOTS[$0]) $word(1 $BOTS[$0]) PRIVMSG $C :ACTION $2-}
@ BC = 1
}
if ([$1] == [KILL])
{
bot kill $0 $2-
@ BC = 1
}
if ([$1] == [JOIN])
{
if ([$2])
{
if (ischannel($2)) {//dcc raw $word(0 $BOTS[$0]) $word(1 $BOTS[$0]) JOIN $2} {/dcc raw $word(0 $BOTS[$0]) $word(1 $BOTS[$0]) JOIN #$2}
} {//dcc raw $word(0 $BOTS[$0]) $word(1 $BOTS[$0]) JOIN $C}
if ([$3]) {^bots.action $0 JOIN $3-}
@ BC = 1
}
if ([$1] == [LEAVE])
{
if ([$2])
{
if (ischannel($2)) {//dcc raw $word(0 $BOTS[$0]) $word(1 $BOTS[$0]) PART $2} {/dcc raw $word(0 $BOTS[$0]) $word(1 $BOTS[$0]) PART #$2}
} {//dcc raw $word(0 $BOTS[$0]) $word(1 $BOTS[$0]) PART $C}
@ BC = 1
}
if ([$1] == [MSG])
{
if ([$3]) {//dcc raw $word(0 $BOTS[$0]) $word(1 $BOTS[$0]) PRIVMSG $2 :$3-} {/echo *** Must specify a target and message}
@ BC = 1
}
if ([$1] == [SAY])
{
if ([$2])
{
if (ischannel($2))
{
if ([$3]) {//dcc raw $word(0 $BOTS[$0]) $word(1 $BOTS[$0]) PRIVMSG $2 :$3-} {/echo *** Must specify a message}
} {//dcc raw $word(0 $BOTS[$0]) $word(1 $BOTS[$0]) PRIVMSG $C :$2-}
} {/echo *** Must specify a message}
@ BC = 1
}
if ([$1] == [NOTICE])
{
if ([$3]) {//dcc raw $word(0 $BOTS[$0]) $word(1 $BOTS[$0]) NOTICE $2 :$3-} {/echo *** Must specify a target and message}
@ BC = 1
}
if ([$1] == [NICK])
{
if ([$2])
{
//dcc raw $word(0 $BOTS[$0]) $word(1 $BOTS[$0]) NICK $2
bots.setopt $0 3 $2
} {/echo *** Must specify a nick}
@ BC = 1
}
if ([$1] == [SET])
{
if ([$2])
{
bots.setopt $0 5 $bots.setbotopt($word(5 $BOTS[$0]) $2-)
}
echo *** Bot #$0 options: $bots.querybotopt($word(5 $BOTS[$0]))
^timer $rand(5) ^bots.dospyons
@ BC = 1
}
if ([$1] == [RANDNICK])
{
@ NEWNICK = randcrap(9)
//dcc raw $word(0 $BOTS[$0]) $word(1 $BOTS[$0]) NICK $NEWNICK
bots.setopt $0 3 $NEWNICK
^assign -NEWNICK
@ BC = 1
}
if ([$1] == [CTCP])
{
if ([$3]) {//dcc raw $word(0 $BOTS[$0]) $word(1 $BOTS[$0]) PRIVMSG $2 :$3-}
{/echo *** Must specify a target and ctcp-command}
@ BC = 1
}
if ([$1] == [MODE])
{
if ([$2])
{
if (ischannel($2)) {//dcc raw $word(0 $BOTS[$0]) $word(1 $BOTS[$0]) MODE $2 $3-} {/dcc raw $word(0 $BOTS[$0]) $word(1 $BOTS[$0]) MODE $C $2-}
} {/echo *** Must specify a mode to change}
@ BC = 1
}
if ([$1] == [QUOTE])
{
if ([$2]) {//dcc raw $word(0 $BOTS[$0]) $word(1 $BOTS[$0]) $2-} {/echo *** Must specify a line to send to the server}
@ BC = 1
}
if ([$1] == [INVITE])
{
if ([$2])
{
if ([$3])
{
if (ischannel($3)) {//dcc raw $word(0 $BOTS[$0]) $word(1 $BOTS[$0]) INVITE $2 $3} {/dcc raw $word(0 $BOTS[$0]) $word(1 $BOTS[$0]) INVITE $2 #$3}
} {//dcc raw $word(0 $BOTS[$0]) $word(1 $BOTS[$0]) INVITE $2 $C}
} {/echo *** Must specify a nick}
@ BC = 1
}
foreach PP.BOTCMDS AA {$PP.BOTCMDS[$AA] $*}
if (!(BC)) {/echo *** No such bot command $1}
^assign -BC
}
# Returns the lowest available bot #
alias bots.getlownum {
@ LOWEST = 1
while (BOTS[$LOWEST]) {@ LOWEST = LOWEST + 1}
@ FUNCTION_RETURN = LOWEST
^assign -LOWEST
}
# ----------------------------------------------------------------------------
# User /bot and /gb aliases
# ----------------------------------------------------------------------------
# MAKE <nick> <server>[:<port>] [<IRCName>]
# LMAKE <nick> <username> <server>[:<port>] [<IRCName>]
# LMASSMAKE <count> <nick-prefix/*> <username> <server>[:<port>] [<IRCName>]
# MASSMAKE <count> <nick-prefix/*> <server>[:<port>] [<IRCName>]
# KILL <botno/*> [<signoff msg>]
# MASSDEOP
alias bot {
if (rmatch($0 *MAKE KILL LIST MASSDEOP))
{
if ([$0] == [MASSDEOP]) {^if (gotops($C)) {/bots.massdeop} {/echo *** You don't have ops on $C}}
if ([$0] == [LMAKE])
{
if ([$3])
{
if (match(*:* $3))
{
@ BS = left($index(: $3) $3)
@ BP = mid(${index(: $3)+1} $rindex($right(1 $3) $3) $3)
}
{
@ BS = [$3]
@ BP = 6667
}
@ BN = bots.getlownum()
if ([$4]) {@ BI = [$4-]} {@ BI = tolower($encode($time()))##[ $randcrap($rand(12))]}
^set input_prompt [#${BN}] Creating bot...
if (bots.domake($BN $BS $BP $1 $2 $PP.SET.BOTS_DFL_OPT $BI)) {^echo *** Bot #${BN} \($1\) created on $3} {/echo *** Error connecting bot $1 to $3}
^set -input_prompt
^assign -BS
^assign -BP
^assign -BI
^assign -BN
} {/echo $PP.BHL}
}
if ([$0] == [MAKE])
{
if ([$2]) {/bot LMAKE $1 $tolower($encode($randcrap($rand(5)))) $2-}
{/echo $PP.BHM}
}
if ([$0] == [KILL])
{
if ([$1])
{
if ([$2]) {@ SM = [$2-]} {@ SM = [Leaving]}
if ([$1] == [*])
{
foreach BOTS AA {^bots.dokill $AA $SM}
echo *** All bots disconnected
}
{
if (bots.dokill($1 $SM)) {/echo *** Bot #$1 disconnected} {/echo *** No such bot #$1}
}
^assign -SM
} {/echo *** /bot kill <botno/*> [<signoff msg>]}
}
if ([$0] == [LIST])
{
^pp.pauseset
echo *** Bot# Nick Server:Port
foreach BOTS AA {
@ BN = word(3 $BOTS[$AA])
echo *** $[6]AA $[9]BN $word(1 $BOTS[$AA]):$word(2 $BOTS[$AA])
}
^assign -BN
^pp.pauseend
}
if ([$0] == [LMASSMAKE])
{
if ([$4])
{
@ CN = 0
while (CN < [$1])
{
if ([$3] == [AA]) {@ LU = tolower($encode($randcrap($rand(5))))} {@ LU = [$3]}
if ([$2] == [*])
{
@ NM = rand(4) + 6
@ LN = randcrap($NM)
^assign -NM
} {@ LN = [$2$bots.getlownum()]}
bot LMAKE $LN $LU $4-
@ CN = CN + 1
}
^assign -LU
^assign -LN
^assign -CN
} {/echo *** /bot lmassmake <count> <nick-prefix/*> <username> <server>[:<port>] [<IRCName>]}
}
if ([$0] == [MASSMAKE])
{
if ([$3]) {/bot LMASSMAKE $1 $2 AA $3-}
{/echo *** /bot massmake <count> <nick-prefix/*> <server>[:<port>] [<IRCName>]}
}
}
{
if ([$1])
{
if ([$0] == [*]) {^foreach BOTS ZZ {/bot $ZZ $1-}} {^if (BOTS[$0]) {^bots.action $*} {/echo *** No such bot #$0}}
} {/echo $PP.BH}
}
^assign -ZZ
^bots.makevars
}
# These are to get around a length limit for what can be under an if statement
^assign PP.BH *** /bot <command> [<options>] -or- /bot <bot#/*> <command> [<options>]
^assign PP.BHL *** /bot lmake <nick> <username> <server>[:<port>] [<IRCName>]
^assign PP.BHM *** /bot make <nick> <server>[:<port>] [<IRCName>]
alias bots {/bot $*}
# a frontend for /bot to easily make guardbots
alias gb {
echo *** Press enter for any of these if you don't care.
^input "Enter a nickname for your guardbot :" ^if (1) {
if ([$0]) {@ GBN = [$0]}
{
@ GBN = randcrap(9)
echo *** Using random nickname ${GBN}
}
echo *** If you want a port other than 6667, type the port after the server name seperated by a space.
^input "Enter a server for your guardbot :" ^if (1) {
if ([$0]) {@ GBS = [$0]}
{
echo *** Using server: ${S}
@ GBS = [$S]
}
if ([$1]) {@ GBP = [$1]} {@ GBP = 6667}
^input "Enter an IRCName for your guardbot :" ^if (1) {
if ([$0]) {@ GBI = [$*]}
{
echo *** Using default IRCName
@ GBI = [[PurePak]]
}
^input "Enter a username for your guardbot :" ^if (1) {
if ([$0]) {@ GBU = [$0]}
{
@ GBU = tolower($encode($rand(9999)))
echo *** Using random username ${GBU}
}
echo *** Creating bot...
@ GBNUM = bots.getlownum()
bot lmake $GBN $GBU ${GBS}:$GBP $GBI
bot $GBNUM set OPSGUARD KICKGUARD BANGUARD SPYMSG FOLLOW FOLLOWL
bot $GBNUM join $mychannels()
echo *** Done... Type /bot kill ${GBNUM} to kill.
^assign -GBNUM
^assign -GBN
^assign -GBU
^assign -GBS
^assign -GBP
^assign -GBI
}
}
}
}
}
# ----------------------------------------------------------------------------
EVAL ^if (!PP.SET.NOSTARTUP) {/echo -- PurePak DCC RAW bots module loaded}